<?php
namespace app\controller;

use app\BaseController;
use think\facade\Db;
use think\facade\Request;

class Data extends BaseController
{
    public function index()
    {
//        $result = Db::table('vy_demo')->where('id',1)->find();

        $result = app('db')->table('vy_demo')->where('id',1)->find();
        dump($result);
    }
    public function demo(){
        $data = [
            'title' => 'demo1',
            'content' =>'我来自上海',
            'category_id' => 2,
            'status'    =>1,
            'create_time' => time()
        ];
        $result = Db::table('vy_demo')->insert($data);
        echo Db::getLastSql();
        dump($result);
    }
}
